﻿@*教师个人信息页面*@
@using EasyCourse.DB;
@using EasyCourse.Model;
@{
    Layout = null;
    CommonPageInfo pageInfo = ViewData[CommonViewDataKey.CommonPageInfo] as CommonPageInfo;
    string para = "CourseId=" + pageInfo.CourseId;
}
@model UserInfo
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>精品课程管理 个人中心</title>
    @Html.Partial("~/Views/Share/PublicHeader.cshtml")
    <style>
        .uploadify { margin:0 auto;}
        .img-thumbnail {display:block;margin:10px auto 0;}
        legend {font-size:16px;}
        .panel-body {min-height:10px;}
        .panel {margin-bottom:5px;}
    </style>
</head>
<body>
        @Html.Partial("~/Views/Share/PublicTopNav4Teacher.cshtml")
        <div class="container">
            <div class="row">
                <h1 class="topTitle-h1">@pageInfo.CourseName<br><small>广州中医药大学康复治疗微课程网络学习平台</small></h1>
            </div>
        </div>
        @*导航菜单*@
        @Html.Partial("~/Views/Share/PublicTeacherNaviMenu.cshtml", 6)
        <div class="container mainwrap mb20">
            <div class="row">
                <div class="col-xs-9 lBox pt15 mainwrap-part">
                    <div class="row">
                        <div class="col-xs-3">
                            <img src="@WebSiteDomain.ResFileDomain@Model.Portrait" class="img-thumbnail" id="JPic" width="150" height="150" />
                        <br />
                        <input id="file_upload" name="file_upload" type="file" class="form-control input-sm">
                        </div>
                        <div class="col-xs-9">
                            <div class="panel panel-default">
                                <div class="panel-heading"><h5>个人信息</h5></div>
                                <div class="panel-body">
                                    <form role="form">
                                <div class="form-group clearfix">
                                    <label class="control-label col-xs-2">角色：</label>
                                    <div class="col-xs-10">
                                        <p class="form-control-static input-sm">教师</p>
                                    </div>
                                </div>
                                <div class="form-group clearfix">
                                    <label class="control-label col-xs-2">姓名：</label>
                                    <div class="col-xs-10">
                                        <p class="form-control-static input-sm">@Model.RealName</p>
                                    </div>
                                </div>
                                <div class="form-group clearfix">
                                    <label class="control-label col-xs-2">已发帖：</label>
                                    <div class="col-xs-10">
                                        <p class="form-control-static input-sm">@Model.DiscussCount</p>
                                    </div>
                                </div>
                            </form>
                                </div>
                            </div>
                            <div class="panel panel-default">
                                <div class="panel-heading"><h5>修改密码</h5></div>
                                <div class="panel-body">
                                    <form id="valid_form" role="form">
                                    <div class="form-group clearfix">
                                <label class="control-label col-xs-2">旧密码:</label>
                                <div class="col-xs-6">
                                    <input class="form-control input-sm" id="JoPwd" name="oldPass" type="password" />
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <label class="control-label col-xs-2">新密码:</label>
                                <div class="col-xs-6">
                                    <input class="form-control input-sm" id="JnPwd" name="newPass" type="password" />
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <label class="control-label col-xs-2">确认新密码:</label>
                                <div class="col-xs-6">
                                    <input class="form-control input-sm" id="JnPwd2" name="confPass" type="password" />
                                </div>
                            </div>
                            <div class="form-group clearfix">
                                <div class="col-xs-offset-2 col-xs-10">
                                    <button class="btn btn-success" id="Jchange" type="button">提交</button>
                                </div>
                            </div>
                        </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-3">
                    @Html.Partial("~/Views/Share/PublicRBox.cshtml")
                </div>
            </div>
        </div>
       @Html.Partial("~/Views/Share/PublicFooter.cshtml")
       @Html.Partial("~/Views/Share/PublicCommonJs.cshtml")
    <link href="../Content/UpLoadFive/uploadifive.css" rel="stylesheet" /> 
    <script type="text/javascript" src="../Content/UpLoadFive/jquery.uploadifive.min.js?V=@DateTime.Now.Ticks"></script>
       <script type="text/javascript">
           //上传文件
           var _attachmentUrl = null;
           $(function () {
               var _courseId = $.getUrlParam("CourseId");
               if (!_courseId) {
                   alert("强制要选择课程");
               }
        //        $("#file_upload").uploadify({
        //            'queueSizeLimit': 1,
        //            //fileType代表文件类型的值可能有:   Image 、 OtherFile 、 Temp
        //            'formData': { 'fileType': 'Image' },
        //            'buttonText': '请选择图片',
        //            'swf': '../Content/uploadify/uploadify.swf',
        //            'uploader': '/Base/UpLoad',
        //            'onUploadSuccess': function (file, data, response) {
        //                var json = $.parseJSON(data);
        //                if (json.result) {
        //                    _attachmentUrl = json.message; //文件保存的地址
        //                    $.easyPost("/UserInfo/EditPortrait", {
        //                        "Portrait": _attachmentUrl
        //                    }, function (data) {
        //                        if (data.result) {
        //                            $("#JPic").attr("src", "@WebSiteDomain.ResFileDomain" + _attachmentUrl);
        //                        } else {
        //                            showTips.open(data.message)
        //                        }
        //                    },"json")
                          
        //                }
        //                else {
        //                    showTips.open(json.message);
        //                }
        //            }
        //        });
        //    });
           $("#file_upload").uploadifive({
                   'queueSizeLimit': 1,
                   //fileType代表文件类型的值可能有:   Image 、 OtherFile 、 Temp
                   'formData': { 'fileType': 'Image' },
                   'buttonText': '请选择图片',
                   'swf': '../Content/uploadify/uploadify.swf',
                   'uploadScript': '/Base/UpLoad',
                   'onUploadComplete': function (file, data, response) {
                       var json = $.parseJSON(data);
                       if (json.result) {
                           _attachmentUrl = json.message; //文件保存的地址
                           $.easyPost("/UserInfo/EditPortrait", {
                               "Portrait": _attachmentUrl
                           }, function (data) {
                               if (data.result) {
                                   $("#JPic").attr("src", "@WebSiteDomain.ResFileDomain" + _attachmentUrl);
                               } else {
                                   showTips.open(data.message)
                               }
                           },"json")
                          
                       }
                       else {
                           showTips.open(json.message);
                       }
                   }
               });
           });
           var JoPwd = $("#JoPwd"),
               JnPwd = $("#JnPwd"),
               JnPwd2 = $("#JnPwd2"),
               Jchange = $("#Jchange");
           Jchange.bind("click", function () {
               $.easyPost("/UserInfo/ChangePassword", {
                   "Password": JnPwd.val(),
                   "Password2": JnPwd2.val(),
                   "OldPassword": JoPwd.val()
               }, function (data) {
                   if (data.result) {
                       showTips.open("更改成功！");
                       $("#valid_form")[0].reset()
                   } else {
                       showTips.open(data.message)
                   }
               }, "json")
           })


       </script>
</body>
</html>